<script setup lang="ts" name="DetailHeader">
const router = useRouter();
const route = useRoute();
const emits = defineEmits(['goBackPage']);
const props = defineProps({
  title: {
    type: String,
    default: '',
  },
  isNeedBackIcon:{
    type: Boolean,
    default: false,
  },
  isNeedRedirectPage:{
    type: Boolean,
    default: false,
  },
  bg:{
    type: String,
    default: '',
  },
  status:{
    type: Number,
    default: null,
  }
});
const images = reactive({
  backIcon: new URL("@/assets/images/Detail/back_icon.png", import.meta.url).href,
});
const backLastPage = () => {
    if (props.isNeedRedirectPage) {
      emits('goBackPage');
    } else {
      router.back();
    }
}
</script>

<template>
  <div class="detailPage" :style="{background: bg}">
    <img :src="images.backIcon" alt="" @click="backLastPage" v-if="isNeedBackIcon">
    <div>
      <slot name="title">
        {{ title }}
      </slot>
    </div>
  </div> 
</template>

<style lang="scss" scoped>
.detailPage{
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56rem;
  line-height: 56rem;
  position: relative;
  background: #FFF;
  // padding: 20rem 16rem 0rem;
  img{
    position: absolute;
    top: 18rem;
    left: 16rem;
    width: 20rem;
    height: 20rem;
  }
  div{
    color: #343C4B;
    text-align: center;
    font-family: Inter;
    font-size: 16rem;
    font-style: normal;
    font-weight: 600;
    line-height: 16rem;
  }
}
</style>
